package com.glsc.ngateway.platform.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

@Entity
@Data
@Table(name = "t_dev_task_log")
@org.hibernate.annotations.Table(appliesTo = "t_dev_task_log",comment = "信息系统主表变更log")
public class DevTaskChangeLog implements Serializable {

    @ApiModelProperty(value = "系统ID")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", columnDefinition = "int(11) comment '系统ID'")
    private Integer id;

    @ApiModelProperty(value = "关联类型")
    @Column(name = "relate_type", columnDefinition = "int(11) comment '关联类型1开发流程,2任务明细'")
    private Integer relateType;

    @ApiModelProperty(value = "关联id")
    @Column(name = "relate_id", columnDefinition = "varchar(64) comment '关联id'")
    private String relateId;

    @ApiModelProperty(value = "状态")
    @Column(name = "status", columnDefinition = "varchar(10) comment '状态'")
    private String status;

    @ApiModelProperty(value = "操作人员账号")
    @Column(name = "op_operator", columnDefinition = "varchar(20) comment '操作人员账号'")
    private String opOperator;

    @ApiModelProperty(value = "操作人员姓名")
    @Column(name = "op_operator_name", columnDefinition = "varchar(20) comment '操作人员姓名'")
    private String opOperatorName;

    @Column(name = "insert_time", columnDefinition = "datetime comment '创建时间'")
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime insertTime;

    @Column(name = "update_time", columnDefinition = "datetime comment '更新时间'")
    @org.hibernate.annotations.UpdateTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime updateTime;

    @ApiModelProperty(value = "完整记录")
    @Column(name = "logJson", columnDefinition = "text comment '完整记录'")
    private String logJson;

    @ApiModelProperty(value = "操作标记")
    @Column(name = "log_flag", columnDefinition = "int(8) comment '操作标记 0增加 1修改 2删除'")
    private Integer logFlag;

}
